﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public class WB03WBReport : BaseReport
    {
        string strCompany = "HLT";
        string strExcelFile = "";
        public WB03WBReport()
            : base()
        {
            AssignColumns();
        }
        public WB03WBReport(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        {
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
            AssignColumns();
        }
        private void AssignColumns()
        {
            columns.Clear();
            columns.Add("ARTICLE"); columns.Add("WBBBESCHICH"); columns.Add("COLORDES"); columns.Add("WBBEINDAT"); 
            columns.Add("WBBDPART"); columns.Add("UNCHECKEDQTY");
            columns.Add("UNCHECKEDMTR"); columns.Add("CHECKEDQTY"); columns.Add("CHECKEDMTR");
            columns.Add("ALLOCATEDQTY"); columns.Add("ALLOCATEDMTR");
            columns.Add("REWORKEDQTY"); columns.Add("REWORKEDMTR"); 
            columns.Add("OTHERQTY");
            columns.Add("OTHERMTR");
             
        }
        public void REPORT2EXCEL(string fileType)
        {
            Queue CellQueue = new Queue();
            string filename = "";
            string sheetName = "";
            string Standard = "Sales_Finish_Stock";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Sales\成品结存报表" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["FINISH_INVENTORY_SUMMARY"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }  
    }
    }


